googologywikiaorg-20200223-history
User blog:B1mb0w/Alpha Function Program Code
'Alpha Function Program Code' The Alpha Function is being defined using program code. Better versions of the code will be worked on. The purpose of this blog is to illustrate how the logic should work via a long-winded manual example. Also refer to the Alpha Function Logic section of the main blog post. 'Definitions' Please refer to another blog for a full description of the Alpha Function program code. For the purposes of this blog, the only relevant code is the aBinary function which simply converts a real number into a binary bit string. The code for this function using the VBA macro language for Microsoft Excel is at the bottom of this blog. For all information on the evaluation and behaviour of the Strong D Function itself, please refer to the detailed blogs at this link. 'Manual Example' Let r = 99.999893. The aBinary Function converts this number to a binary bit string: aBinary(99.999893) = "7-1100011111111111111100011111" and the string is converted into nested Strong D Functions. "7-1'100011111111111111100011111" First we start with 2 Strong D Functions with 7 parameters. The second D function called b is actually nested as the 1st parameter of the first D Function called a. Every other letter represents another potentially nesed Strong D Function with (up to) 7 parameters. a. \(D(b,c,d,e,f,g,h)\) b. \(D(j,k,l,m,n,p,q)\) "7-1'1000111'11111111111100011111" This step is easy and the next 7 bits are simply inserted into Strong D Function b. This means that we do not need to expand k,l,m,n,p or q because they all equal 0 or 1 only. If the first bit j was 0 and not 1 then this step would be more difficult like the examples in the next steps. b. \(D(1,0,0,0,1,1,1)\) "7-11000111'1111'1111111100011111" In this step we move to Strong D function c, but c must be expanded into more nested D functions, and each nested D function is allowed to be <= the value of b. The next 4 bits in the string are all 1. This means the D function r will in fact equal b. c. \(D(r,s,t,u,v,w,x)\) r. \(D(1,0,0,0,1,1,1)\) "7-110001111111'1111'111100011111" Strong D function s will also equal the value of b because we have another four bits equal to 1. s. \(D(1,0,0,0,1,1,1)\) "7-1100011111111111'1111'00011111" Strong D function t will also equal the value of b because we have another four bits equal to 1. t. \(D(1,0,0,0,1,1,1)\) "7-11000111111111111111'0'0011111" Strong D function u will be more complicated. A 0 bit will substitute for the first parameter in u. This means all remaining parameters will be nested D functions with (up to) 6 parameters. The 6 is derived from the parameter size of u minus 1. u. \(D(0,x,y,z,aa,ab,ac)\) "7-110001111111111111110'0'011111" Strong D function x also gets a 0 bit substituted for the first parameter and all remaining parameters will be nested D functions with (up to) 5 parameters. x. \(D(0,ac,ad,ae,af,ag)\) "7-1100011111111111111100'0'11111" Strong D function ac also gets a 0 bit substituted for the first parameter and all remaining parameters will be nested D functions with (up to) 4 parameters. ac. \(D(0,ah,ai,aj,ak)\) "7-11000111111111111111000'1111'1" Strong D function ah will be simpler because all parameters will be 1 using the next four bits in the string. ah. \(D(1,1,1,1)\) "7-110001111111111111110001111'1" We can return to Strong D function ai and use the final 1 bit in the string. Because the string is now exhausted, we can trace back through all the D functions and replace any unresolved parameter with 0. Starting with ai we get: ai. \(D(1,0,0,0)\) and ac. \(D(0,ah,ai,0,0) = D(ah,ai,0,0)\) x. \(D(0,ac,0,0,0,0) = D(ac,0,0,0,0)\) u. \(D(0,x,0,0,0,0,0) = D(x,0,0,0,0,0)\) c. \(D(r,s,t,u,0,0,0)\) a. \(D(b,c,0,0,0,0,0)\) "7-1100011111111111111100011111" The final string of nested Strong D Functions becomes: \(D(b,c,0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),c,0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(r,s,t,u,0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),s,t,u,0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),t,u,0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(u,0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(D(x,0,0,0,0,0),0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(D(D(ac,0,0,0,0),0,0,0,0,0),0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(D,D(D(ah,ai,0,0),0,0,0,0),0,0,0,0,0),0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(D(D(D(D(1,1,1,1),ai,0,0),0,0,0,0),0,0,0,0,0),0,0,0),0,0,0,0,0)\) \( = D(D(1,0,0,0,1,1,1),D(D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),D(1,0,0,0,1,1,1),\) continued cont. \(D(D(D(D(1,1,1,1),D(1,0,0,0),0,0),0,0,0,0),0,0,0,0,0),0,0,0),0,0,0,0,0)\) 'References' Alpha Function Program Code *Version 2 Work in Progress *Version 1 'Program Code for the aBinary Function' The following is VBA visual basic code and will run as a macro in Microsoft Excel. The aBinary function converts a real number into a binary bit string. It is used by the Alpha Function program code (Version 1). Option Explicit Dim aReal As String Function aBinary(d As Double) As String Const MaxDepth = -15 Dim i As Integer, j As Integer, e As Double, f As Double e = d i = 0 While e >= 1 i = i + 1 e = e / 2 Wend f = 2 ^ (i - 1) e = d - f aBinary = i & IIf(d >= 0.5, "-1", "-0") For j = (i - 2) To MaxDepth Step -1 f = f / 2 If e >= f Then e = e - f aBinary = aBinary & "1" Else aBinary = aBinary & "0" End If Next j While Right(aBinary, 1) = "0" aBinary = Left(aBinary, Len(aBinary) - 1) Wend End Function Category:Blog posts